<layout name="layout"/>
<include file="./nav"/>

<!-- BEGIN CONTAINER -->

<div class="page-container row-fluid">

    <!-- BEGIN PAGE -->

    <div class="page-content">

        <!-- BEGIN PAGE CONTAINER-->

        <div class="container-fluid">

            <!-- BEGIN PAGE HEADER-->

            <div class="row-fluid">

                <div class="span12">

                    <!-- BEGIN PAGE TITLE & BREADCRUMB-->

                    <h3 class="page-title">{$_page_title}</h3>

                    <ul class="breadcrumb">

                        <li>

                            <i class="icon-home"></i>

                            <a href="{:U('Index/index')}">首页</a>

                            <i class="icon-angle-right"></i>

                        </li>

                        <li>

                            <a href="#">{$_module_name}</a>

                            <i class="icon-angle-right"></i>

                        </li>

                        <li><a href="#">{$_page_btn_name}</a></li>

                    </ul>

                    <!-- END PAGE TITLE & BREADCRUMB-->

                </div>

            </div>

            <!-- END PAGE HEADER-->

            <!-- BEGIN PAGE CONTENT-->

            <div class="row-fluid">

                <div class="span12">

                    <!-- BEGIN EXAMPLE TABLE PORTLET-->

                    <div >

                        <div class="portlet-title">

                            <div class="caption"><i class="icon-edit"></i>商品信息</div>

                            <div class="tools">
                                <a href="{:U('Goods/add')}" style="font-size: 18px;margin-right:20px">添加商品</a>
                            </div>

                        </div>

                        <div class="form-div">
                            <form action=__ACTION__ method="get" name="searchForm">
                                <img src="__PUBLIC__/Admin/Images/icon_search.gif" width="26" height="22" border="0" alt="search" />
                                <!-- 分类 -->
                                <p>
                                    商品名称：
                                    <input type="text" value="<?php echo I('get.gn'); ?>" name="gn" size="60"/>
                                </p>
                                <p>
                                    分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类：
                                    <?php
                                        $catId = I('get.cat_id'); ?>
                                        <select name="cat_id">
                                        <option value="">选择分类</option>
                                        <?php foreach($catData as $k=>$v):
                                        if($v['id'] == $catId)
                                        $select = 'selected="selected"';
                                        else
                                        $select = '';
                                        ?>
                                        <option <?php echo $select; ?> value="<?php echo $v['id']; ?>"><?php echo str_repeat('-',8*$v['level']).$v['cat_name']; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </p>
                                <p>
                                    品&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;牌：
                                    <?php buildSelect('brand','brand_id','id','brand_name',I('get.brand_id')); ?>
                                </p>
                                <p>
                                    价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 格：
                                    从<input type="text" value="<?php echo I('get.fp'); ?>" name="fp" size="8"/>
                                    到<input type="text" value="<?php echo I('get.tp'); ?>" name="tp" size="8"/>
                                </p>
                                <p >
                                    是否上架：
                                    <?php $ios = I('get.ios'); ?>
                                    <input type="radio" name="ios" value="" <?php if($ios == '') echo 'checked="checked"'; ?> />全部
                                    <input type="radio" name="ios" value="1" <?php if($ios == '1') echo 'checked="checked"'; ?>/>上架
                                    <input type="radio" name="ios" value="0" <?php if($ios == '0') echo 'checked="checked"'; ?>/>下架
                                </p>
                                <p>
                                    添加时间：
                                    从<input type="text" id='fa' value="<?php echo I('get.fa'); ?>" name="fa" size="20"/>
                                    到<input type="text" id='ta' value="<?php echo I('get.ta'); ?>" name="ta" size="20"/>
                                </p>
                                <p>
                                    排序方式：
                                    <?php $obdy = I('get.odby','id_desc'); ?>
                                    <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="id_desc"<?php if($obdy == 'id_desc') echo 'checked="checked"'; ?>/>商品编号降序
                                    <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="id_asc"<?php if($obdy == 'id_asc') echo 'checked="checked"'; ?>/>商品编号升序
                                    <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="price_desc"<?php if($obdy == 'price_desc') echo 'checked="checked"'; ?>/>价格从高到低
                                    <input onclick="this.parentNode.parentNode.submit();" type="radio" name="odby" value="price_asc"<?php if($obdy == 'price_asc') echo 'checked="checked"'; ?>/>价格从低到高

                                </p>
                                <button type="submit" class="btn btn-success">搜索</button>
                            </form>
                        </div>

                        <form method="post" action="" name="listForm" onsubmit="">
                            <div>
                                <table cellpadding="3" cellspacing="1" class="table table-striped table-hover table-bordered dataTable">
                                    <thead style="background: #C5C1AA">
                                    <tr role="row">
                                        <th >编号</th>
                                        <th width="15%">商品名称</th>
                                        <th>主分类</th>
                                        <th>扩展分类</th>
                                        <th>品牌</th>

                                        <th>本店价格</th>
                                        <th>市场价格</th>
                                        <th>上架</th>
                                        <th>Logo</th>
                                        <th>添加时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <foreach name="data" item="val">
                                        <tbody>
                                        <tr class="tron">
                                            <td >{$val.id}</td>
                                            <td ><span>{$val.goods_name}</span></td>
                                            <td>{$val.cat_name}</td>
                                            <td>{$val.ext_cat_name}</td>
                                            <td ><span value="{$val.id}">{$val.brand_name}</span></td>

                                            <td><span>{$val.shop_price}</span></td>
                                            <td><span>{$val.market_price}</span></td>
                                            <td><img src="<if condition='($val.is_onsale eq 1)'> __PUBLIC__/Admin/Images/yes.gif <else/> __PUBLIC__/Admin/Images/no.gif </if>"/></td>
                                            <td><?php showImage($val['sm_logo']); ?></td>
                                            <td>{$val.addtime}</td>
                                            <td>
                                                <a href="{:U('Goods/goods_number')}?id={$val.id}"  title="查看库存"><img src="__PUBLIC__/Admin/Images/icon_view.gif" width="16" height="16" border="0" /></a>
                                                <a href="{:U('Goods/edit')}?id={$val.id}" title="编辑"><img src="__PUBLIC__/Admin/Images/icon_edit.gif" width="16" height="16" border="0" /></a>
                                                <a href="{:U('Goods/del')}?id={$val.id}" onclick="return confirm('确定删除吗')" title="回收站"><img src="__PUBLIC__/Admin/Images/icon_trash.gif" width="16" height="16" border="0" /></a></td>
                                        </tr>
                                        </tbody>
                                    </foreach>
                                </table>
                            </div>
                            <div class="span6" style="margin:-30px 0 0 858px;">
                                <div class="dataTables_paginate paging_bootstrap pagination" >
                                    <ul >
                                        <li>{$page}</li>
                                    </ul>
                                </div>
                            </div>
                        </form>

                    </div>

                    <!-- END EXAMPLE TABLE PORTLET-->

                </div>

            </div>

            <!-- END PAGE CONTENT -->

        </div>

        <!-- END PAGE CONTAINER-->

    </div>

    <!-- END PAGE -->

</div>

<!-- END CONTAINER -->

<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

<!-- BEGIN CORE PLUGINS -->

<script src="__PUBLIC__/media/js/jquery-1.10.1.min.js" type="text/javascript"></script>

<script src="__PUBLIC__/media/js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>

<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

<script src="__PUBLIC__/media/js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>

<script src="__PUBLIC__/media/js/bootstrap.min.js" type="text/javascript"></script>

<!--[if lt IE 9]>

<script src="__PUBLIC__/media/js/excanvas.min.js"></script>

<script src="__PUBLIC__/media/js/respond.min.js"></script>

<![endif]-->

<script src="__PUBLIC__/media/js/jquery.slimscroll.min.js" type="text/javascript"></script>

<script src="__PUBLIC__/media/js/jquery.blockui.min.js" type="text/javascript"></script>

<script src="__PUBLIC__/media/js/jquery.cookie.min.js" type="text/javascript"></script>

<script src="__PUBLIC__/media/js/jquery.uniform.min.js" type="text/javascript" ></script>

<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL PLUGINS -->

<script type="text/javascript" src="__PUBLIC__/media/js/select2.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/media/js/jquery.dataTables.js"></script>

<script type="text/javascript" src="__PUBLIC__/media/js/DT_bootstrap.js"></script>

<!-- END PAGE LEVEL PLUGINS -->

<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="__PUBLIC__/media/js/app.js"></script>

<script src="__PUBLIC__/media/js/table-editable.js"></script>

<script>

    jQuery(document).ready(function() {

        App.init();

        TableEditable.init();

    });

</script>

</body>

<!-- END BODY -->

</html>

<!--时间插件-->
<link href="__PUBLIC__/datetimepicker/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/datetimepicker/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/datetimepicker/datepicker-zh_cn.js"></script>
<link rel="stylesheet" media="all" type="text/css" href="__PUBLIC__/datetimepicker/time/jquery-ui-timepicker-addon.min.css" />
<script type="text/javascript" src="__PUBLIC__/datetimepicker/time/jquery-ui-timepicker-addon.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/datetimepicker/time/i18n/jquery-ui-timepicker-addon-i18n.min.js"></script>
<script>
// 添加时间插件
    $.timepicker.setDefaults($.timepicker.regional['zh-CN']);  // 设置使用中文

    $("#fa").datetimepicker();
    $("#ta").datetimepicker();
</script>

<!-- 引入行高亮显示 -->
<script type="text/javascript" src="__PUBLIC__/Admin/Js/tron.js"></script>
